<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .c1{
            width: 100px;
            height: 100px;
        }
        .redbox{
            background-color: red;
        }
        .border{
            border:5px solid black;
        }
    </style>
</head>

<body>
    <div id="app">
        <input type="button" value="边框" @click="changeBorder">
        <!-- class使用对象-->
        <p class="c1" :class="{redbox:true,border:isBorder}">我是个p</p>

        <input type="button" value="边框" @click="changeBorder2">
        <!-- class使用数组 -->
        <p class="c1" :class="['redbox','border']">我依然是那个p</p>
        <p class="c1" :class="arr">我依然是那个p</p>
        

    </div>
    <script src="./js/vue.js"></script>

    <script>
        let vm = new Vue({
            el: "#app",
            data: {
                isBorder:true,
                arr:['redbox','border']
            },
            methods:{
                changeBorder(){
                    this.isBorder = !this.isBorder;
                },
                changeBorder2(){
                    this.arr.pop();
                }
            }
        })

    </script>
</body>

</html>